<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="dao.Users,java.net.URLEncoder"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户管理</title>
</head>
<body>
<c:set var="obj" value="${sessionScope.UserMessage}"/>
<c:remove var="MessageType" scope="session"/>
<div style=" height:300px; line-height:30px" align="center" >
		<h1>用户管理</h1>
			当前登录用户：${obj.username}<br>
			昵称：${obj.nickname}<br>   
  	   <form action="javascript:location.href='${pageContext.request.contextPath}/users/update.jsp?id=${obj.id}
  	   &username='+encodeURI('${obj.username}')+'&nickname='+encodeURI('${obj.nickname}')+'&password='+encodeURI('${obj.password}')" method="post">
  	   		<input name="submittype" type="submit" value="修改当前用户"/>
  	   </form>
  	   <c:if test="${obj.id==1}">
  	    <form action="${pageContext.request.contextPath}/users/add.jsp" method="post">
  	   		<input name="submittype" type="submit" value="添加用户"/><br> 
  	   </form>
  	   </c:if>
		<form action="${pageContext.request.contextPath}/users/getUser" method="post">
			查询指定用户：<input name="name" type="text" value="">
			<input name="submittype" type="submit" value="查询指定用户"/><br>
		</form>
		<form action="${pageContext.request.contextPath}/users/getAll" method="post"> 
			<input name="submittype" type="submit" value="查看所有用户"/><br>
		</form>
		<form action="${pageContext.request.contextPath}/users/delete" method="post"> 
			<input name="submittype" type="submit" value="删除当前用户"/><br> 
		</form>
		<form action="${pageContext.request.contextPath}/users/quit" method="post"> 
			<input type="submit" name="submittype" value="退出登录">
		</form>
  	   
  	   <form action="${pageContext.request.contextPath}/message/getMessage" method="post">
			<input name="submittype" type="submit" value="返回查看所有留言"/>
  	</form>
	<p>${error}</p>
	</div>
</body>
</html>